﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria.Localization;

namespace Terraria.ModLoader
{
	// Token: 0x020001F5 RID: 501
	public class ModTile
	{
		// Token: 0x1700019A RID: 410
		// (get) Token: 0x06001594 RID: 5524 RVA: 0x00010946 File Offset: 0x0000EB46
		// (set) Token: 0x06001595 RID: 5525 RVA: 0x0001094E File Offset: 0x0000EB4E
		public Mod mod { get; internal set; }

		// Token: 0x1700019B RID: 411
		// (get) Token: 0x06001596 RID: 5526 RVA: 0x00010957 File Offset: 0x0000EB57
		// (set) Token: 0x06001597 RID: 5527 RVA: 0x0001095F File Offset: 0x0000EB5F
		public string Name { get; internal set; }

		// Token: 0x1700019C RID: 412
		// (get) Token: 0x06001598 RID: 5528 RVA: 0x00010968 File Offset: 0x0000EB68
		// (set) Token: 0x06001599 RID: 5529 RVA: 0x00010970 File Offset: 0x0000EB70
		public ushort Type { get; internal set; }

		// Token: 0x1700019D RID: 413
		// (get) Token: 0x0600159A RID: 5530 RVA: 0x00010979 File Offset: 0x0000EB79
		public virtual string HighlightTexture
		{
			get
			{
				return this.texture + "_Highlight";
			}
		}

		// Token: 0x0600159B RID: 5531 RVA: 0x0001098B File Offset: 0x0000EB8B
		public void AddToArray(ref int[] array)
		{
			Array.Resize<int>(ref array, array.Length + 1);
			array[array.Length - 1] = (int)this.Type;
		}

		// Token: 0x0600159C RID: 5532 RVA: 0x004143C4 File Offset: 0x004125C4
		public void AddMapEntry(Color color, LocalizedText name = null)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name);
				if (!MapLoader.tileEntries.Keys.Contains(this.Type))
				{
					MapLoader.tileEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.tileEntries[this.Type].Add(item);
			}
		}

		// Token: 0x0600159D RID: 5533 RVA: 0x000109A8 File Offset: 0x0000EBA8
		public ModTranslation CreateMapEntryName(string key = null)
		{
			if (string.IsNullOrEmpty(key))
			{
				key = this.Name;
			}
			return this.mod.GetOrCreateTranslation(string.Format("Mods.{0}.MapObject.{1}", this.mod.Name, key), false);
		}

		// Token: 0x0600159E RID: 5534 RVA: 0x00414424 File Offset: 0x00412624
		public void AddMapEntry(Color color, ModTranslation name)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name);
				if (!MapLoader.tileEntries.Keys.Contains(this.Type))
				{
					MapLoader.tileEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.tileEntries[this.Type].Add(item);
			}
		}

		// Token: 0x0600159F RID: 5535 RVA: 0x00414484 File Offset: 0x00412684
		public void AddMapEntry(Color color, LocalizedText name, Func<string, int, int, string> nameFunc)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name, nameFunc);
				if (!MapLoader.tileEntries.Keys.Contains(this.Type))
				{
					MapLoader.tileEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.tileEntries[this.Type].Add(item);
			}
		}

		// Token: 0x060015A0 RID: 5536 RVA: 0x004144E4 File Offset: 0x004126E4
		public void AddMapEntry(Color color, ModTranslation name, Func<string, int, int, string> nameFunc)
		{
			if (!MapLoader.initialized)
			{
				MapEntry item = new MapEntry(color, name, nameFunc);
				if (!MapLoader.tileEntries.Keys.Contains(this.Type))
				{
					MapLoader.tileEntries[this.Type] = new List<MapEntry>();
				}
				MapLoader.tileEntries[this.Type].Add(item);
			}
		}

		// Token: 0x060015A1 RID: 5537 RVA: 0x000109DC File Offset: 0x0000EBDC
		public void SetModTree(ModTree tree)
		{
			TileLoader.trees[(int)this.Type] = tree;
		}

		// Token: 0x060015A2 RID: 5538 RVA: 0x000109EF File Offset: 0x0000EBEF
		public void SetModPalmTree(ModPalmTree palmTree)
		{
			TileLoader.palmTrees[(int)this.Type] = palmTree;
		}

		// Token: 0x060015A3 RID: 5539 RVA: 0x00010A02 File Offset: 0x0000EC02
		public void SetModCactus(ModCactus cactus)
		{
			TileLoader.cacti[(int)this.Type] = cactus;
		}

		// Token: 0x060015A4 RID: 5540 RVA: 0x00010A15 File Offset: 0x0000EC15
		public virtual bool Autoload(ref string name, ref string texture)
		{
			return this.mod.Properties.Autoload;
		}

		// Token: 0x060015A5 RID: 5541 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SetDefaults()
		{
		}

		// Token: 0x060015A6 RID: 5542 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void PostSetDefaults()
		{
		}

		// Token: 0x060015A7 RID: 5543 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual bool HasSmartInteract()
		{
			return false;
		}

		// Token: 0x060015A8 RID: 5544 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool KillSound(int i, int j)
		{
			return true;
		}

		// Token: 0x060015A9 RID: 5545 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void NumDust(int i, int j, bool fail, ref int num)
		{
		}

		// Token: 0x060015AA RID: 5546 RVA: 0x00010A27 File Offset: 0x0000EC27
		public virtual bool CreateDust(int i, int j, ref int type)
		{
			type = this.dustType;
			return true;
		}

		// Token: 0x060015AB RID: 5547 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void DropCritterChance(int i, int j, ref int wormChance, ref int grassHopperChance, ref int jungleGrubChance)
		{
		}

		// Token: 0x060015AC RID: 5548 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool Drop(int i, int j)
		{
			return true;
		}

		// Token: 0x060015AD RID: 5549 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool CanKillTile(int i, int j, ref bool blockDamaged)
		{
			return true;
		}

		// Token: 0x060015AE RID: 5550 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem)
		{
		}

		// Token: 0x060015AF RID: 5551 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void KillMultiTile(int i, int j, int frameX, int frameY)
		{
		}

		// Token: 0x060015B0 RID: 5552 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool CanExplode(int i, int j)
		{
			return true;
		}

		// Token: 0x060015B1 RID: 5553 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void NearbyEffects(int i, int j, bool closer)
		{
		}

		// Token: 0x060015B2 RID: 5554 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ModifyLight(int i, int j, ref float r, ref float g, ref float b)
		{
		}

		// Token: 0x060015B3 RID: 5555 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual bool Dangersense(int i, int j, Player player)
		{
			return false;
		}

		// Token: 0x060015B4 RID: 5556 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SetSpriteEffects(int i, int j, ref SpriteEffects spriteEffects)
		{
		}

		// Token: 0x060015B5 RID: 5557 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height)
		{
		}

		// Token: 0x060015B6 RID: 5558 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void AnimateTile(ref int frame, ref int frameCounter)
		{
		}

		// Token: 0x060015B7 RID: 5559 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset)
		{
		}

		// Token: 0x060015B8 RID: 5560 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool PreDraw(int i, int j, SpriteBatch spriteBatch)
		{
			return true;
		}

		// Token: 0x060015B9 RID: 5561 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex)
		{
		}

		// Token: 0x060015BA RID: 5562 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void PostDraw(int i, int j, SpriteBatch spriteBatch)
		{
		}

		// Token: 0x060015BB RID: 5563 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void SpecialDraw(int i, int j, SpriteBatch spriteBatch)
		{
		}

		// Token: 0x060015BC RID: 5564 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual ushort GetMapOption(int i, int j)
		{
			return 0;
		}

		// Token: 0x060015BD RID: 5565 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void RandomUpdate(int i, int j)
		{
		}

		// Token: 0x060015BE RID: 5566 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
		{
			return true;
		}

		// Token: 0x060015BF RID: 5567 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool CanPlace(int i, int j)
		{
			return true;
		}

		// Token: 0x060015C0 RID: 5568 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void RightClick(int i, int j)
		{
		}

		// Token: 0x060015C1 RID: 5569 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void MouseOver(int i, int j)
		{
		}

		// Token: 0x060015C2 RID: 5570 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void MouseOverFar(int i, int j)
		{
		}

		// Token: 0x060015C3 RID: 5571 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual bool AutoSelect(int i, int j, Item item)
		{
			return false;
		}

		// Token: 0x060015C4 RID: 5572 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void HitWire(int i, int j)
		{
		}

		// Token: 0x060015C5 RID: 5573 RVA: 0x00008CF7 File Offset: 0x00006EF7
		public virtual bool Slope(int i, int j)
		{
			return true;
		}

		// Token: 0x060015C6 RID: 5574 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void FloorVisuals(Player player)
		{
		}

		// Token: 0x060015C7 RID: 5575 RVA: 0x0000ADF8 File Offset: 0x00008FF8
		public virtual bool HasWalkDust()
		{
			return false;
		}

		// Token: 0x060015C8 RID: 5576 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void WalkDust(ref int dustType, ref bool makeDust, ref Color color)
		{
		}

		// Token: 0x060015C9 RID: 5577 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void ChangeWaterfallStyle(ref int style)
		{
		}

		// Token: 0x060015CA RID: 5578 RVA: 0x0000EAB6 File Offset: 0x0000CCB6
		public virtual int SaplingGrowthType(ref int style)
		{
			return -1;
		}

		// Token: 0x060015CB RID: 5579 RVA: 0x00006B58 File Offset: 0x00004D58
		public virtual void PlaceInWorld(int i, int j, Item item)
		{
		}

		// Token: 0x04001504 RID: 5380
		internal string texture;

		// Token: 0x04001505 RID: 5381
		public int soundType;

		// Token: 0x04001506 RID: 5382
		public int soundStyle = 1;

		// Token: 0x04001507 RID: 5383
		public int dustType;

		// Token: 0x04001508 RID: 5384
		public int drop;

		// Token: 0x04001509 RID: 5385
		public int animationFrameHeight;

		// Token: 0x0400150A RID: 5386
		public float mineResist = 1f;

		// Token: 0x0400150B RID: 5387
		public int minPick;

		// Token: 0x0400150C RID: 5388
		public bool disableSmartCursor;

		// Token: 0x0400150D RID: 5389
		public bool disableSmartInteract;

		// Token: 0x0400150E RID: 5390
		public int[] adjTiles = new int[0];

		// Token: 0x0400150F RID: 5391
		public int closeDoorID = -1;

		// Token: 0x04001510 RID: 5392
		public int openDoorID = -1;

		// Token: 0x04001511 RID: 5393
		public string chest = "";

		// Token: 0x04001512 RID: 5394
		public int chestDrop;

		// Token: 0x04001513 RID: 5395
		public string dresser = "";

		// Token: 0x04001514 RID: 5396
		public int dresserDrop;

		// Token: 0x04001515 RID: 5397
		public bool bed;

		// Token: 0x04001516 RID: 5398
		public bool torch;

		// Token: 0x04001517 RID: 5399
		public bool sapling;
	}
}
